package com.example.scheduled;

import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

/**
 * Created by xiaoyuan on 2017/11/24.
 * 定时任务
 */
@Component
public class ScheduledTask {
    private int i=0;

    /**
     * 每2s执行一次任务
     */
    //@Scheduled(fixedRate = 2000)
    public void systemOut(){
        System.out.println(Thread.currentThread().getId());
        System.out.println("scheduled "+ i++);
    }
}
